package com.softservecom.training.shop.pojos;

import java.io.FileInputStream;
import java.sql.Blob;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Images entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "Images", schema = "dbo", catalog = "Java")
public class Images implements java.io.Serializable {

	// Fields

	private Integer imageId;
	private byte data[];
	private Set<UsersDetails> usersDetailses = new HashSet<UsersDetails>(0);
	private Set<Products> productses = new HashSet<Products>(0);

	// Constructors

	/** default constructor */
	public Images() {
	}

	/** minimal constructor */
	public Images(Integer imageId, byte[] data) {
		this.imageId = imageId;
		this.data = data;
	}

	/** full constructor */
	public Images(Integer imageId, byte[] data,
			Set<UsersDetails> usersDetailses, Set<Products> productses) {
		this.imageId = imageId;
		this.data = data;
		this.usersDetailses = usersDetailses;
		this.productses = productses;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "ImageID", unique = true, nullable = false)
	public Integer getImageId() {
		return this.imageId;
	}

	public void setImageId(Integer imageId) {
		this.imageId = imageId;
	}

	@Column(name = "Data", nullable = false)
	public byte[] getData() {
		return this.data;
	}

	public void setData(byte[] data) {
		this.data = data;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "images")
	public Set<UsersDetails> getUsersDetailses() {
		return this.usersDetailses;
	}

	public void setUsersDetailses(Set<UsersDetails> usersDetailses) {
		this.usersDetailses = usersDetailses;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "imageses")
	public Set<Products> getProductses() {
		return this.productses;
	}

	public void setProductses(Set<Products> productses) {
		this.productses = productses;
	}

}